<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="icon" href="./icon.png" type="image/png">
    <style>
        .common {
            width: 200px;
            height: 200px;
        }

        .box {
            background-color: pink;
        }

        .box2 {
            background-color: aqua;
        }
    </style>
</head>

<body>
    <div id="app">
        <h2>{{ JSON.stringify(list) }}</h2>
        <button @click="list.splice(0,1,{name:'ss',age:111})">点击 </button>
        <h2>{{obj.name}}</h2>
        <button @click="obj.name+='~'">obj改</button>
    </div>
    <script src="./vue.js"> </script>
    <script>
        const app = new Vue({
            el: "#app",
            data: {
                list: [{ name: 'zs', age: 13 }, { name: 'ls', age: 14 }, { name: 'ww', age: 15 }]
                , obj: {
                    name: 'ss',
                    age: 111
                }
            },
            methods: {

            },
            watch: {
                list(val, oldVal) {
                    console.log('数据改变了');
                },
                obj: {
                    handler(val, oldVal) {
                        console.log('数据改变了', val);
                    },
                    deep: true
                },
                'obj.name'(val, oldVal) {
                    console.log('改变了', val);

                }
            }
        })

    </script>
</body>

</html>